function u = ex2_7(x0, y0)
    if nargin < 1
        x0 = 5;
    end
    if nargin < 2
        y0 = 5;
    end
    M = 9;
    %% generate distribution
    a = zeros(M, M);
    for i=1:M
        for j=1:M
            %a(i,j) = uint8(round(255.0 * exp(-sqrt((i-x0)*(i-x0)+(j-y0)*(j-y0)))));
            a(i,j) = uint8(round(255.0 * exp(-((i-x0)*(i-x0)+(j-y0)*(j-y0))) ));
        end
    end
    %% filter the original image
    u = cell(8,1);
    for k = 8:-1:1
        %k
        u{k} = filter(a,k);
        %dispimg(u{k},k);
    end
end

function m1 = filter(m,k)
    m1 = m;
    n = 2^(8-k);
    [M,N] = size(m);
    for i=1:M
        for j=1:N
            m1(i,j) = round(m(i,j) / n);
        end
    end
end